const puppeteer = require('puppeteer');

async function main() {
    try {
        // 启动浏览器
        const browser = await puppeteer.launch({
            headless: false,
            defaultViewport: null,
            channel: 'chrome',  // 使用本地Chrome
            executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
            userDataDir: `${process.env.HOME}/Library/Application Support/Google/Chrome`,  // macOS 路径
            args: ['--profile-directory=Profile 2']  // 指定用户配置文件
        });
        // ... existing code ...
    } catch (error) {
        console.error('测试过程中发生错误:', error);
    }
}